<?php
/**
 * Created by PhpStorm.
 * User: xuyiping
 * Date: 2018/7/5
 * Time: 11:26
 */
namespace app\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use Symfony\Component\HttpFoundation\Request;
use Illuminate\Support\Facades\DB;
use App\Http\Controllers\Admin\GoldController;
use App\Model\WebUserModel;

class ApiMainController extends Controller{

    public $_defalutJson=Array("code"=>200,"data"=>Array(),"message"=>"");
    const APPID = '';
    const SECRET = '';
    public $userId='';
    public $uuid='';
    public $sUserName='';

    public function __construct(){

        //record(url()->full(),url()->full());
        //获取用uuid
        $uuid=empty($_GET['uuid']) ? '':trim($_GET['uuid']);
        $this->uuid=$uuid;
        if(strlen($this->uuid) == 20){
            $user = WebUserModel::select('iSeqId','iUUID','sUserName')->where("iUUID","like",$uuid."%")->get()->toArray();
        }else{
            $user = WebUserModel::select('iSeqId','iUUID','sUserName')->where("iUUID","=",$uuid)->get()->toArray();
        }
        if(empty($user)) {
            $this->_defalutJson['code']=-1;
            $this->_defalutJson['message']="用户不存在！！";
        }else{
            $this->userId=$user[0]['iSeqId'];
            $this->sUserName=$user[0]['sUserName'];
        }

    }

}